package com.wmlive.hhvideo.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

import butterknife.BindView;
import cn.wmlive.hhvideo.R;

/**
 * Created by lsq on 5/27/2017.
 * 首页底部的tab
 */
public class MainTabView extends BaseCustomView {
    @BindView(R.id.ivIcon)
    ImageView ivIcon;
    @BindView(R.id.tvText)
    TextView tvText;
    @BindView(R.id.llCenter)
    LinearLayout llCenter;
    @BindView(R.id.ivRedDot)
    ImageView ivRedDot;

    public MainTabView(Context context) {
        super(context);
    }

    @Override
    protected int getLayoutId() {
        return R.layout.maintabview_layout;
    }

    @Override
    protected void initViews(Context context, AttributeSet attrs, int defStyle) {

    }

    public void setTabText(String s) {
        tvText.setText(s);
    }

    public ImageView getIvIcon() {
        return ivIcon;
    }

    public String getTvText() {
        return tvText.getText().toString();
    }

    public void setTextFocus(boolean focus) {
        tvText.setTextColor(getContext().getResources().getColor(focus ? R.color.colorPrimary : R.color.bg_black));
    }

    public void setTabIcon(int resId) {
        ivIcon.setImageResource(resId);
    }


    @Override
    public void showView(int visible) {
        ivRedDot.setVisibility(visible);
    }
}
